<?php

require_once ("src/Money.class.php");
require_once ("src/MoneyOps.class.php");
require_once ("src/MoneyExceptions.php");

class MoneyOpsTestCase extends PHPUnit_Framework_TestCase
{
	private static $f12EUR, $f14EUR, $f26EUR,$f12LIVRE ;
        public static function setUpBeforeClass() {
		MoneyOpsTestCase::$f12EUR=MoneyFactory::getDefaultFactory()->createMoney(12,"EUR");
        MoneyOpsTestCase::$f12LIVRE=MoneyFactory::getDefaultFactory()->createMoney(12,"LIVRE");
		MoneyOpsTestCase::$f14EUR=MoneyFactory::getDefaultFactory()->createMoney(14,"EUR");
		MoneyOpsTestCase::$f26EUR=MoneyFactory::getDefaultFactory()->createMoney(26,"EUR");
	}

	public function testSimpleAdd() {
        $this->assertTrue(
			MoneyOps::add(
				MoneyOpsTestCase::$f12EUR,
				MoneyOpsTestCase::$f14EUR)
			->equals(MoneyOpsTestCase::$f26EUR)
		);
	}

    public function testIncompatiblesCurrenciesExecption() {
        $this->setExpectedException('IncompatiblesCurrenciesException');

        MoneyOps::add(
                    MoneyOpsTestCase::$f12LIVRE,
                    MoneyOpsTestCase::$f14EUR);

    }

    public function testInvalidOperationException() {
        $this->setExpectedException('InvalidOperationException');

        operationAction::index('mult');

    }

}
?>
